<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
 
/**
 * Script file of HelloWorld component
 */
class com_congregationInstallerScript
{
	/**
	 * method to install the component
	 *
	 * @return void
	 */
	function install($parent) 
	{
		
		$dest_dir = JPATH_ROOT . DS . 'media' . DS . 'congregation'. DS . 'profiles' . DS . 'originals';
		$thumb_dir = JPATH_ROOT . DS . 'media' . DS . 'congregation'. DS . 'profiles' . DS . 'thumbnails';
		if(!is_dir($dest_dir))
		{
			@mkdir($dest_dir, 0777);
		}
		if(!is_dir($thumb_dir))
		{
			@mkdir($thumb_dir, 0777);
		}		
		// $parent is the class calling this method
		$parent->getParent()->setRedirectURL('index.php?option=com_congregation');
		
	}
 
	/**
	 * method to uninstall the component
	 *
	 * @return void
	 */
	function uninstall($parent) 
	{
		// $parent is the class calling this method
		echo '<p>' . JText::_('COM_CONGREGATION_UNINSTALL_TEXT') . '</p>';
	}
 
	/**
	 * method to update the component
	 *
	 * @return void
	 */
	function update($parent) 
	{
		// $parent is the class calling this method
		echo '<p>' . JText::_('COM_CONGREGATION_UPDATE_TEXT') . '</p>';
	}
 
	/**
	 * method to run before an install/update/uninstall method
	 *
	 * @return void
	 */
	function preflight($type, $parent) 
	{
		// $parent is the class calling this method
		// $type is the type of change (install, update or discover_install)
		echo '<p>' . JText::_('COM_CONGREGATION_PREFLIGHT_' . $type . '_TEXT') . '</p>';
	}
 
	/**
	 * method to run after an install/update/uninstall method
	 *
	 * @return void
	 */
	function postflight($type, $parent) 
	{
		// $parent is the class calling this method
		// $type is the type of change (install, update or discover_install)
		echo '<p>' . JText::_('COM_CONGREGATION_POSTFLIGHT_' . $type . '_TEXT') . '</p>';
	}
}